#!/usr/bin/perl -w
use strict;

use Bio::AlignIO;

my $infile = shift @ARGV; # 1st argument is input file
my $informat = 'clustalw'; # input format is clustalw
my $outformat = 'fasta';   # output format

# output will be written to STDOUT so you run this
# perl clustal2fasaln.pl myfile.aln > myfile.fasaln

my $in = Bio::AlignIO->new(-format => $informat,
			   -file   => $infile);
my $out = Bio::AlignIO->new(-format => $outformat);

while( my $aln = $in->next_aln ) {
    $aln->map_chars('\.','-');
    $aln->set_displayname_flat(1);
    $out->write_aln($aln);
}
